package com.cs.paoyer.administration.business;

import com.cs.paoyer.administration.business.model.ContractVO;
//import com.cs.paoyer.common.exception.SystemException;
//import com.cs.paoyer.common.exception.UserException;
//import java.rmi.RemoteException;
import java.util.Vector;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.util.Collection;

import com.cs.paoyer.administration.business.model.FDClassVO;
import com.cs.paoyer.administration.business.model.FDTypeVO;
import com.cs.paoyer.administration.business.model.UserVO;
import com.cs.paoyer.administration.business.model.ApplicationVO;
import com.cs.paoyer.administration.business.model.UserGroupVO;
import com.cs.paoyer.administration.business.model.OptionVO;
import com.cs.paoyer.administration.business.model.ProgramVO;
import com.cs.paoyer.administration.business.model.ProgramParameterVO;
import com.cs.paoyer.administration.business.model.UserGroupOptionVO;
import com.cs.paoyer.administration.business.model.ApplicationUserVO;
import com.cs.paoyer.administration.business.model.FDVO;
import com.cs.paoyer.administration.business.model.FlexValueVO;
import com.cs.paoyer.administration.business.model.AuthorizedByBranchVO;
import com.cs.paoyer.administration.business.model.WarehouseByBranchVO;
import com.cs.paoyer.administration.business.model.CostCenterByAuthorizedVO;


import com.cs.paoyer.administration.business.AdministrationMngr;
import javax.naming.InitialContext;
import javax.naming.NamingException;
//import javax.rmi.PortableRemoteObject;
import com.cs.beneficios.business.entity.AdministrationFacadeLocalLocalHome;

public class AdministrationFacadeBean implements SessionBean 
{
	public void ejbCreate()
	{
	}

	public void ejbActivate()
	{
	}

	public void ejbPassivate()
	{
	}

	public void ejbRemove()
	{
	}

	public void setSessionContext(SessionContext ctx)
	{
	}

	public UserVO authenticateUser( UserVO user ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.authenticateUser(user);
  }
  public String getMenu( String strUserGroup, String strPath ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.getMenu(strUserGroup,strPath);
  }
  
  public Vector getResources( UserVO user ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.getResources(user);
  }
  
  public UserVO userGroup( UserVO user ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.userGroup(user);
  }


	public Collection findUserByCriterea(UserVO user) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findUserByCriterea(user);
  }
  
  public boolean createUser(UserVO user) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createUser(user);
  }

  public boolean updateUser(UserVO user) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateUser(user);
  }

	public boolean deleteUser(UserVO user)
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.deleteUser(user);
  }
//------------------------------------------------------------------------------

	public ApplicationVO createApplication(ApplicationVO application) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createApplication(application);
  }

  public Collection findApplicationByCriterea(ApplicationVO application) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findApplicationByCriterea(application);
  }

  public int updateApplication(ApplicationVO application) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateApplication(application);
  }

	public int deleteApplication(ApplicationVO application)
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.deleteApplication(application);
  }

			public UserGroupVO createUserGroup( UserGroupVO userGroup )
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createUserGroup(userGroup);
  }
	public Collection findUserGroupByCriterea( UserGroupVO userGroup ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findUserGroupByCriterea(userGroup);
  }
	public UserGroupVO updateUserGroup( UserGroupVO userGroup ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateUserGroup(userGroup);
  }
	public void deleteUserGroup( UserGroupVO userGroup ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			manager.deleteUserGroup(userGroup);
  }



	public OptionVO createOption( OptionVO option ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createOption(option);
  }
	public Collection findOptionByCriterea( OptionVO option ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findOptionByCriterea(option);
  }
	public OptionVO updateOption( OptionVO option ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateOption(option);
  }
	public void deleteOption( OptionVO option ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			manager.deleteOption(option);
  }



	public ProgramVO createProgram( ProgramVO program ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createProgram(program);
  }
	public Collection findProgramByCriterea( ProgramVO program ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findProgramByCriterea(program);
  }
	public ProgramVO updateProgram( ProgramVO program ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateProgram(program);
  }
	public void deleteProgram( ProgramVO program ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			manager.deleteProgram(program);
  }


	public ProgramParameterVO createProgramParameter( ProgramParameterVO programParameter ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createProgramParameter(programParameter);
  }
	public Collection findProgramParameterByCriterea( ProgramParameterVO programParameter )
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findProgramParameterByCriterea(programParameter);
  }
	public ProgramParameterVO updateProgramParameter( ProgramParameterVO programParameter )
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateProgramParameter(programParameter);
  }
	public void deleteProgramParameter( ProgramParameterVO programParameter )
	{
			AdministrationMngr manager = new AdministrationMngr();
			manager.deleteProgramParameter(programParameter);
  }




	public UserGroupOptionVO createUserGroupOption( UserGroupOptionVO userGroupOption ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createUserGroupOption(userGroupOption);
  }
	public Collection findNotAsociatedOptionByCriterea( UserGroupOptionVO userGroupOption )
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findNotAsociatedOptionByCriterea(userGroupOption);
  }
  
  public boolean asociateOptionToUserGroup( UserGroupOptionVO userGroupOption )
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.asociateOptionToUserGroup(userGroupOption);
  }
  public Collection findUserGroupOptionByCriterea( UserGroupOptionVO userGroupOption )
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findUserGroupOptionByCriterea(userGroupOption);
  }
  
	public UserGroupOptionVO updateUserGroupOption( UserGroupOptionVO userGroupOption ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateUserGroupOption(userGroupOption);
  }
	public void deleteUserGroupOption( UserGroupOptionVO userGroupOption )
	{
			AdministrationMngr manager = new AdministrationMngr();
			manager.deleteUserGroupOption(userGroupOption);
  }




	public ApplicationUserVO createApplicationUser( ApplicationUserVO applicationUser ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createApplicationUser(applicationUser);
  }
	public Collection findApplicationUserByCriterea( ApplicationUserVO applicationUser ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findApplicationUserByCriterea(applicationUser);
  }
  public Collection findUserNotAsociatedByCriterea(ApplicationUserVO criterea) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findUserNotAsociatedByCriterea(criterea);
  }
	public ApplicationUserVO updateApplicationUser( ApplicationUserVO applicationUser ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateApplicationUser(applicationUser);
  }
	public void deleteApplicationUser( ApplicationUserVO applicationUser ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			manager.deleteApplicationUser(applicationUser);
  }



		public FlexValueVO createFlexValue( FlexValueVO flexValue ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createFlexValue(flexValue);
  }
	public Collection findFlexValueByCriterea( FlexValueVO flexValue ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findFlexValueByCriterea(flexValue);
  }
	public boolean updateFlexValue( FlexValueVO flexValue ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateFlexValue(flexValue);
  }
	public boolean deleteFlexValue( FlexValueVO flexValue )
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.deleteFlexValue(flexValue);
  }
  
  public Collection findFlexValueTypeByCriterea(FlexValueVO criterea)
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findFlexValueTypeByCriterea(criterea);
  } 
  
  public FlexValueVO createFlexValueType( FlexValueVO flexValueType )
  {
			AdministrationMngr manager = new AdministrationMngr();
			return manager.createFlexValueType(flexValueType);
  }
  
  public boolean updateFlexValueType( FlexValueVO flexValueType )
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.updateFlexValueType(flexValueType);
  }
  
	public boolean deleteFlexValueType( FlexValueVO flexValueType )  
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.deleteFlexValueType(flexValueType);
  }
  //Consultas
	public Collection findInventoryByCriterea(FDVO fd) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findInventoryByCriterea(fd);
  }
  
  public Collection findContractByCriterea(ContractVO criterea) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findContractByCriterea(criterea);
  }
  
  	public Collection findAuthorizedBranchByCriterea( AuthorizedByBranchVO authorizedByBranch ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findAuthorizedBranchByCriterea(authorizedByBranch);
  }
  

	public Collection findWarehouseBranchByCriterea( WarehouseByBranchVO warehouseByBranch ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findWarehouseBranchByCriterea(warehouseByBranch);
  }


	public Collection findCostCenterAuthorizedByCriterea( CostCenterByAuthorizedVO costCenterByAuthorized ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findCostCenterAuthorizedByCriterea(costCenterByAuthorized);
  }

	public Collection findFDClassByCriterea( FDClassVO fdClass ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findFDClassByCriterea(fdClass);
  }

	public Collection findFDTypeByCriterea( FDTypeVO fdType ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findFDTypeByCriterea(fdType);
  }

	public Collection findFDHistoryByCriterea( FDVO fdVO ) 
	{
			AdministrationMngr manager = new AdministrationMngr();
			return manager.findFDHistoryByCriterea(fdVO);
  }

  private AdministrationFacadeLocalLocalHome getAdministrationFacadeLocalLocalHome() throws NamingException
  {
    final InitialContext context = new InitialContext();
    return (AdministrationFacadeLocalLocalHome)context.lookup("java:comp/env/ejb/local/AdministrationFacadeLocal");
  }


}